package com.responsibilityChain;

public class Test {
    public static void main(String[] args) {
        //创建一个请求
        PurchaseRequest request = new PurchaseRequest(0 ,60000 , 1);

        //创建相关的审批人
        DepartmentApprover departmentApprover = new DepartmentApprover("教学主任");
        ColleageApprover colleageApprover = new ColleageApprover("院长");
        ViceSchoolMasterApprover viceSchoolMasterApprover = new ViceSchoolMasterApprover("副校长");
        SchoolMasterApprover schoolMasterApprover = new SchoolMasterApprover("【校长】");

        //给审批人设置其下一个审批人，形成一条链
        departmentApprover.setNextApprover(colleageApprover);
        colleageApprover.setNextApprover(viceSchoolMasterApprover);
        viceSchoolMasterApprover.setNextApprover(schoolMasterApprover);
        //链条要构成一个环装  校长的下一个处理人是 教学主任
        schoolMasterApprover.setNextApprover(departmentApprover);

        //不管从谁开始都是可以处理请求
        departmentApprover.processRequest(request);
        //schoolMasterApprover.processRequest(request);

    }
}
